package com.jason.bean;

import java.sql.Timestamp;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity(name = "role")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Role {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	@Column(name = "name", length = 50, nullable = false, unique = true)
	private String name;
	@CreationTimestamp
	@Column(name = "create_time", nullable = false)
	private Timestamp createTime;
	@UpdateTimestamp
	@Column(name = "update_time")
	private Timestamp updateTime;
	@Column(name = "status", length = 2, nullable = false)
	private Integer status;
//	@ManyToMany(mappedBy="roles",fetch=FetchType.LAZY)
//	private Set<UserInfo> users;
//	@ManyToMany(cascade = CascadeType.ALL,fetch=FetchType.LAZY)
//	@JoinTable(name = "role_resource", 
//		joinColumns = @JoinColumn(name = "role_id",referencedColumnName="id"), 
//		inverseJoinColumns = @JoinColumn(name = "resource_id",referencedColumnName="id"))
//	private Set<Resource> resources;
}
